package com.baizhiedu.injection;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * ClassName: Category
 * Description:
 * Date: 2022/11/25 PM 2:53:01
 * <p>
 * project: spring5
 * package: com.baizhiedu.injection
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
@Component
@PropertySource("classpath:init.properties")
public class Category {

    /**
     * /@Value 注解不能应用在静态成员变量上 如果应用，赋值(注入)
     * /@Value 注解 + Properties 这种方式不能注入集合类型
     * Spring 提供新的配置形式 YAML YML (SpringBoot)
     */
    @Value("${id}")
    private Integer id;

    @Value("${name}")
    private String name;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
